import LangJs from './js';

export const LangMenu: any = {
  "javascript": LangJs,
}

class LangConfig {

  defaultConfig = LangJs;

  constructor() {

  }

  excludesPath() {
    return this.defaultConfig.excludes;
  }
  matchFile() {
    return this.defaultConfig.match;
  }


  setLang(type: string) {
    this.defaultConfig = LangMenu[type];
  }

  parse(data: any, rootPath: string) {
    const files = data.files;
    data.externals = this.defaultConfig.getExternals(rootPath);
    for (const i in files) {
      this.defaultConfig.parse(i, data.externals).forEach(val => {
        files[val] && files[val].push(i);
      });
    }
  }

}

export const langConfig = new LangConfig();